﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using IDotNet.MapLibs.Web.Model;

namespace IDotNet.MapLibs.Web
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“IMapService”。
    [ServiceContract]
    public interface IMapService
    {

        /// <summary>
        /// 根据地址解析地理坐标
        /// </summary>
        /// <param name="address"></param>
        /// <param name="city"></param>
        /// <returns></returns>
        [OperationContract]
        AddressLocationResultInfo GetAddressLocation(string address, string city);

        /// <summary>
        /// 根据传进来的坐标计算所有点距当前坐标距离(结果未排序)
        /// </summary>
        /// <param name="data"></param>
        /// <param name="curPoint">当前坐标</param>
        /// <returns></returns>
        [OperationContract]
        List<MapPointDistanceModel> GetDistance(List<MapPointModel> data, PointModel curPoint);

        /// <summary>
        /// 根据传进来的坐标计算所有点距当前坐标距离，返回最近的前几个坐标
        /// </summary>
        /// <param name="data"></param>
        /// <param name="curPoint">当前坐标</param>
        /// <param name="top">返回最近的前几个坐标</param>
        /// <returns></returns>
        [OperationContract]
        List<MapPointDistanceModel> GetDistnaceNearby(List<MapPointModel> data, PointModel curPoint, int top);

        /// <summary>
        /// 计算一个点是否在多边形里
        /// </summary>
        /// <param name="p">坐标</param>
        /// <param name="pts">多边形坐标数组</param>
        /// <returns></returns>
        [OperationContract]
        bool IsInsidePolygon(PointModel p, List<PointModel> pts);

        /// <summary>
        /// 计算一个点是否在所给区域坐标，返回最先找到的那个区域
        /// </summary>
        /// <param name="p">当前位置坐标</param>
        /// <param name="pts">所有区域</param>
        /// <returns></returns>
        [OperationContract]
        MapAreaSearchResult IsInsidePolygon(PointModel p, List<MapData> pts);
    }
}
